---
layout: layouts/base.njk
---
<div class="o-layout__sidebar"></div>

<div class="o-layout__main o-layout-typography" data-o-component="o-syntax-highlight">
	<h1 id="#api-reference">API Reference</h1>
	<div>
		<h2 id="get-v3-polyfill-(minify)">Requesting a minified polyfill bundle</h2>
		<p>Get a bundle of polyfills which have been minified ready for production website use. This endpoint responds with a JavaScript file containing the polyfills which should be served to the requesting browser.</p>

		<h3 id="request">Request</h3>

		<table class="o-table o-table--horizontal-lines o-table--row-headings">
			<tbody>
				<tr>
					<th scope="row">Method</th>
					<td>
						<code>GET</code>
					</td>
				</tr>
				<tr>
					<th scope="row">
						Path
					</th>
					<td>
						<code>/v3/polyfill.min.js</code>
					</td>
				</tr>
				<tr>
					<th scope="row">Querystring</th>
					<td>
						<dl>
							<dt>
								<code>
									<var>features</var>
								</code>
							</dt>
							<dd>
								<p>Comma-separated list of the polyfills which you want to include in the response if the requesting browser does not support the feature natively.</p>
								<p>Available feature names are shown on the <a href="/v3/url-builder">features page</a>.</p>
								<dl>
									<dt>
										<code>|always</code>
									</dt>
									<dd>Polyfill should be included regardless of whether it is required by the user-agent making the request.  If there are multiple browser-specific variants of the polyfill, the default one will be used for browser that doesn't actually require the polyfill.  In some cases where the only way of implementing a polyfill is to use browser-specific proprietary technology, the default variant may be empty.</dd>
									<dt>
										<code>|gated</code>
									</dt>
									<dd>If the polyfill is included in the bundle, it will be accompanied by a feature detect, which will only execute the polyfill if the native API is not present.</dd>
								</dl>

								<p>Omitting or setting to an empty string is equivalent to the value "default", which is an alias for a curated list of polyfills.</p>
							</dd>
							<dt>
								<code>
									<var>callback</var>
								</code>
							</dt>
							<dd>
								Name of the JavaScript function to call after the polyfill bundle is loaded.
							</dd>
							<dt>
								<code>
									<var>unknown</var>
								</code>
							</dt>
							<dd>
								What to do for browsers which are not supported. Possible values are `ignore` and `polyfill`. Setting to
								`ignore` will return
								no polyfills to unsuported browsers. Setting to `polyfill` will return all requested polyfills to unsupported
								browsers. Default is `polyfill`.
							</dd>
							<dt>
								<code>
									<var>flags</var>
								</code>
							</dt>
							<dd>
								Configuration settings for every polyfill being requested. Possible values are `always` and `gated`. Setting
								`always` will
								return all requested polyfills to every browser. Setting `gated` will wrap every polyfill within a feature
								detection,
								only adding the polyfill if the feature was not detected. To enable both settings, separate them with a comma
								E.G.
								`always,gated`.
							</dd>
						</dl>
					</td>
				</tr>
				<tr>
					<th scope="row">Headers</th>
					<td>
						<dl>
							<dt>
								<code><var>User-Agent</var></code>
							</dt>
							<dd>
								<p>If no <code><var>ua</var></code> querystring value is configured, the <code><var>User-Agent</var></code> header's value will be used for polyfill targeting instead.</p>
							</dd>
							<dt>
								<code><var>Accept-Encoding</var></code>
							</dt>
							<dd>
								<p>If no <code><var>compression</var></code> querystring value is configured, the <code><var>Accept-Encoding</var></code> header's value will be used to decide if compression should be used on the polyfill</p>
							</dd>
						</dl>
					</td>
				</tr>
			</tbody>
		</table>

		<h4>Example request:</h4>
		<p>Requesting the polyfill sets: ES5, ES6, and ES7. Wrapping each polyfill in a feature detect</p>
		<pre><code class="o-syntax-highlight--html">https://polyfill.io/v3/polyfill.js?features=es5,es6,es7&amp;flags=gated</code></pre>

		<h3 id="response">Response</h3>

		<table class="o-table o-table--horizontal-lines o-table--row-headings">
			<tbody>
				<tr>
					<th scope="row">Status</th>
					<td>
						<code>200</code> on success
					</td>
				</tr>
				<tr>
					<th scope="row">Headers</th>
					<td>
						<dl>
							<dt>Content-Type</dt>
							<dd>
								<code>text/javascript;charset=UTF-8</code>
								<br>
							</dd>
							<dt>Normalized-User-Agent</dt>
							<dd>
								The User-Agent that was detected and was used for polyfill targeting.
								<br>
							</dd>
						</dl>
					</td>
				</tr>
				<tr>
					<th scope="row">Body</th>
					<td>
						The bundle of JavaScript polyfills.
					</td>
				</tr>
			</tbody>
		</table>
	</div>
</div>
